<?php

namespace mpend\modules\app\controllers;

use Yii;
use mpend\components\Controller;
use mpend\modules\app\models\ServiceHomeSearch;
use mpend\modules\app\models\CustomerServiceSearch;

/**
 * 用户服务中心
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class ServiceController extends Controller {

    /**
     * {@inheritdoc}
     */
    public $modelClass = ServiceHomeSearch::class;

    /**
     * {@inheritdoc}
     */
    protected function verbs() {
        return [
            '*' => ['GET'],
        ];
    }

    /**
     * 问题与帮助分类列表
     * @inheritdoc
     */
    public function actionIndex() {
        /* @var $model ServiceHomeSearch */
        $model = new $this->modelClass;
        return $model->toArray();
    }

    /**
     * 联系客服
     * @inheritdoc
     */
    public function actionConnect() {
        /* @var $model CustomerServiceSearch */
        $model = new CustomerServiceSearch();
        return $model->connect($this->uid);
    }

}
